package avicit.bdp.dms.das.rest;

import avicit.bdp.dms.das.dto.BdpDasBusinessLinkDTO;
import avicit.bdp.dms.das.service.BdpDasBusinessLinkService;
import avicit.platform6.core.rest.msg.ResponseMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;



/**
 * 数据模型关系管理REST接口
 */
@RestController
@Api(tags = "数据模型关系管理REST接口")
@RequestMapping("/api/bdp/dms/das/businessLink")
public class BdpDasBusinessLinkRest {

    private static final Logger LOGGER = LoggerFactory.getLogger(BdpDasBusinessLinkRest.class);

    @Autowired
    private BdpDasBusinessLinkService bdpDasBusinessLinkService;



    /**
     * 新增关系对象
     * @param bdpDasBusinessLink
     * @return
     */
    @ApiOperation(value = "新增对象")
    @PostMapping("insertBdpDasBusinessLink")
    public ResponseMsg<BdpDasBusinessLinkDTO> insertBdpDasBusinessLink(@RequestBody BdpDasBusinessLinkDTO bdpDasBusinessLink) {
        ResponseMsg<BdpDasBusinessLinkDTO> responseMsg = new ResponseMsg<>();
        responseMsg.setResponseBody(bdpDasBusinessLinkService.insertBdpDasBusinessLink(bdpDasBusinessLink));
        return responseMsg;
    }

    /**
     * 删除关系对象
     */

    @ApiOperation(value = "删除关系对象")
    @ApiParam(value = "主键id", name = "id", required = true)
    @DeleteMapping
    public ResponseMsg<Boolean> deleteBusinessLink(@RequestBody String id) {
        ResponseMsg<Boolean> responseMsg = new ResponseMsg<>();
        bdpDasBusinessLinkService.deleteBusinessLink(id);
        return responseMsg;
    }


    /**
     * 修改
     */
    @PostMapping("/updateBdpDasBusinessLink")
    @ApiOperation(value = "修改对象")
    public ResponseMsg<String> updateBdpDasBusinessLink(@RequestBody BdpDasBusinessLinkDTO bdpDasBusinessLink) {
        ResponseMsg<String> responseMsg = new ResponseMsg<>();
        bdpDasBusinessLinkService.updateBdpDasBusinessLink(bdpDasBusinessLink);
        return responseMsg;
    }
}